Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add e2e test for hook finalizer which prevents external resource deletion #21113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dejanzele
Copy link

This PR adds a test for the issue with stuck hooks when a hook resource gets deleted externally (i.e. Job with ttlSecondsAfterFinished: 0).

This partially closes #21055

This PR uses a replace in the go.mod to use my fork of the gitops-engine as a proof that the change works as expected in ArgoCD.

This PR is dependant on the following gitops-engine PR argoproj/gitops-engine#646

Related issues:

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@dejanzele dejanzele requested a review from a team as a code owner December 9, 2024 23:49
Copy link

bunnyshell bot commented Dec 9, 2024

❗ Preview Environment deployment failed on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@dejanzele dejanzele force-pushed the feat/hook-finalizer-test branch from 2c2a2d2 to f148cbc Compare December 9, 2024 23:51
@dejanzele dejanzele changed the title feat: add test for hook finalizer which prevents external resource deletion feat: add e2e test for hook finalizer which prevents external resource deletion Dec 9, 2024
@dejanzele dejanzele force-pushed the feat/hook-finalizer-test branch 2 times, most recently from 4d1fd27 to 96010d5 Compare December 10, 2024 00:26
@crenshaw-dev
Copy link
Member

In my mind, the perfect e2e test would:

  1. sync an app with a hook that takes ~1min to complete
  2. stop app reconciliation (turn off the controller? disconnect the target cluster?)
  3. kubectl delete the hook resource
  4. re-enable reconciliation
  5. assert that the sync operation completes successfully

Ideally this test would fail on master, because Argo CD will miss the status updates on the hook resource, but it would succeed on this PR, because the hook resource's deletion would be blocked by the finalizer.

@dejanzele
Copy link
Author

Ok, so this test is a really simple check to validate the finalizer gets added/removed for all sync phases, and that app is healthy and sync fine.

Do you think it makes sense to have a simple and advanced test? The simple test just validates the logic quickly, and the advanced test validates what you just mentioned, because in the advanced test, there are mulitple pieces?

@crenshaw-dev
Copy link
Member

Yep, probably fine to have both!

@dejanzele dejanzele force-pushed the feat/hook-finalizer-test branch 2 times, most recently from a9c99d6 to 9398dad Compare December 11, 2024 23:07
@dejanzele dejanzele force-pushed the feat/hook-finalizer-test branch from 9398dad to f2debad Compare December 11, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stuck hooks issue when a sync tasks contains a Job resource with a ttlSecondsAfterFinished field set
2 participants